#!/bin/sh /etc/rc.common
# Copyright (C) 2012 OpenWrt.org

START=99

EXTRA_COMMANDS="status lucistat"
EXTRA_HELP="	status  Get DSL status information
	lucistat  Get status information if lua friendly format"

SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1

. /lib/functions/lantiq_dsl.sh
XDSL_CTRL=vdsl_cpe_control

start() {
	local firmware xtu
	
	config_load network
	
	config_get firmware wan firmware
	[ -z "${firmware}" ] &&
		firmware=vdsl.bin

	config_get xtu wan xtu
	[ -z "${xtu}" ] &&
		xtu=10_00_10_00_00_04_01_07

	service_start /sbin/vdsl_cpe_control \
		-i${xtu} \
		-T4_0_1
		-n /sbin/dsl_notify.sh \
		-f /lib/firmware/${firmware}
}

stop() {
	DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
	DSL_INTERFACE_STATUS="DOWN" \
		/sbin/dsl_notify.sh

	service_stop /sbin/vdsl_cpe_control
}
